package com.nbsaas.boot.room.rest.convert;

import com.nbsaas.boot.room.data.entity.RoomPrice;
import com.nbsaas.boot.room.api.domain.request.RoomPriceRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.room.data.entity.Room;

/**
* 请求对象转换成实体对象
*/

public class RoomPriceEntityConvert  implements Converter<RoomPrice, RoomPriceRequest> {

    @Override
    public RoomPrice convert(RoomPriceRequest source) {
        RoomPrice result = new RoomPrice();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getRoom()!=null){
                    Room room =new Room();
                    room.setId(source.getRoom());
                    result.setRoom(room);
                    }
        return result;
    }
}

